Skip to content

feat: Add colorization based on health level for panels and toolbar #2178

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hunzlahmalik
Copy link

@hunzlahmalik hunzlahmalik commented Aug 10, 2025

Description

This PR introduces a unified health/alert state for Django Debug Toolbar panels and updates the UI to reflect panel.
The name health is debatable, but the alert was already taken by the panel.

Key Changes

  • Adds a ToolbarHealthLevel enum (NONE, WARNING, CRITICAL) for numeric health states.

  • Adds a health_level property to the base Panel class, allowing panels to report their health status.

  • Implements health_level in AlertsPanel and SQLPanel for alert and slow query detection.

  • The toolbar now computes the maximum health level across all panels and uses it to color the hidden toolbar handle.

  • UI Updates:

    • Panel buttons and the hidden toolbar handle use new CSS classes and colors based on health level.
    • Adds CSS variables and styles for warning and critical states.
Warning Warning on Hover Critical Critical on Hover
image image image image
Critical on Panel Warning on Panel
image image

Motivation

  • Improves user experience by visually highlighting issues in the toolbar.

Checklist:

  • I have added the relevant tests for this change.
  • I have added an item to the Pending section of docs/changes.rst.
  • Add to Documentation

@hunzlahmalik
Copy link
Author

hunzlahmalik commented Aug 10, 2025

@matthiask @tim-schilling

I'll be writing the testcases for this. It would be great if you could take a look at it before testcases.

Thanks!

Edit: You can also suggest how to compute health(debatable name) across other panel profiling, time etc...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant